//
//  GKUserModel.swift
//  MySwiftObject
//
//  Created by wangws1990 on 2019/9/17.
//  Copyright © 2019 wangws1990. All rights reserved.
//

import UIKit
import HandyJSON

class GKUserModel: HandyJSON {
    
    required init() {
       
    }
    var state:Int!;
    var rankDatas:[GKRankModel]!;
}
class GKUserManager : NSObject{
    class func saveModel(model:GKUserModel) {
        let defaults = UserDefaults.standard;
        let dic :NSDictionary = model.toJSON()! as NSDictionary;
        if dic.count > 0 {
            defaults.set(dic, forKey: "GKUserInfo");
            defaults.synchronize();
        }
    }
    class func getModel() ->GKUserModel{
        let data = UserDefaults.standard.object(forKey:"GKUserInfo");
        var model :GKUserModel!;
        if data != nil {
            let dic:NSDictionary = data as! NSDictionary;
            model = GKUserModel.deserialize(from: dic)!
            return model;
        }
        return GKUserModel.init();
    }
}
